//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Spreadsheet.Extensibility;

namespace OpenLS.Spreadsheet.Expressions
{
    class RangeListExpression : BinaryRangeExpression
    {
        public RangeListExpression(Expression left, Expression right)
            : base(left, right)
        {
        }
        protected override ICellEnumerator CreateCellsValue(ICellEnumerator left, ICellEnumerator right)
        {
            return new RangeList(left.ToRange(), right.ToRange());
        }
        public override string GetText(TextContext context)
        {
            return string.Format("{0},{1}", Left.GetText(context), Right.GetText(context));
        }

        protected override Expression CreateExpression(CellEnumeratorExpression left, CellEnumeratorExpression right)
        {
            return new RangeListExpression(left, right);
        }
        internal override Expression Transposed(Cell target)
        {
            return new RangeListExpression(Left.Transposed(target), Right.Transposed(target));
        }
    }
}